home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / osrc.arc / MBUF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-17  |  1.9 KB  |  60 lines

  1. #ifndef    NULLBUF
  2.  
  3. #include "global.h"
  4.  
  5. /* Basic message buffer structure */
  6. struct mbuf {
  7.     struct mbuf *next;    /* Links mbufs belonging to single packets */
  8.     struct mbuf *anext;    /* Links packets on queues */
  9.     int16 size;        /* Size of associated data buffer */
  10.     int refcnt;        /* Reference count */
  11.     struct mbuf *dup;    /* Pointer to duplicated mbuf */
  12.     char *data;        /* Active working pointers */
  13.     int16 cnt;
  14. };
  15. #define    NULLBUF    (struct mbuf *)0
  16. #define    NULLBUFP (struct mbuf **)0
  17. #if    defined(__STDC__) || defined(__TURBOC__)
  18. void enqueue(struct mbuf **q,struct mbuf *bp);
  19. void hex_dump(struct mbuf **bpp);
  20. void ascii_dump(struct mbuf **bpp);
  21. void append(struct mbuf **bph,struct mbuf *bp);
  22. void free_q(struct mbuf **q);
  23. void trim_mbuf(struct mbuf **bpp,int16 length);
  24. struct mbuf *alloc_mbuf(int16 size);
  25. struct mbuf *free_mbuf(struct mbuf *bp);
  26. struct mbuf *dequeue(struct mbuf **q);
  27. struct mbuf *copy_p(struct mbuf *bp,int16 cnt);
  28. struct mbuf *free_p(struct mbuf *bp);
  29. struct mbuf *qdata(char *data,int16 cnt);
  30. struct mbuf *pushdown(struct mbuf *bp,int16 size);
  31. int16 pullup(struct mbuf **bph,char *buf,int16 cnt);
  32. int16 dup_p(struct mbuf **hp,struct mbuf *bp,int16 offset,int16 cnt);
  33. int16 len_mbuf(struct mbuf *bp);
  34. int16 dqdata(struct mbuf *bp,char *buf,unsigned cnt);
  35. int16 len_q(struct mbuf *bp);
  36. int32 pull32(struct mbuf **bpp);
  37. int32 get32(char *cp);
  38. int16 pull16(struct mbuf **bpp);
  39. int16 get16(char *cp);
  40. char pullchar(struct mbuf **bpp);
  41. char *put16(char *cp,int16 x);
  42. char *put32(char *cp,int32 x);
  43. #else
  44. void enqueue(),hex_dump(),ascii_dump(),append();
  45. void free_q();
  46. void trim_mbuf();
  47. struct mbuf *alloc_mbuf(),*free_mbuf(),*dequeue(),*copy_p(),*free_p(),*qdata(),
  48.     *pushdown();
  49. int16 pullup(),dup_p(),len_mbuf(),dqdata(),len_q();
  50. int32 pull32(),get32();
  51. int16 pull16(),get16();
  52. char pullchar(),*put16(),*put32();
  53. #endif
  54. #define    AUDIT(bp)    audit(bp,__FILE__,__LINE__)
  55.  
  56.  
  57. #endif    /* NULLBUF */
  58.  
  59.  
  60.